package ${javaAttribute.model.packageName};

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

<#list packages as pkg>
import ${pkg}
</#list>

/**
 * <p>
 * ${javaAttribute.description}模型
 * </p>
 * @author ${docInfo.author}
 * @date ${docInfo.createTime}
 * Copyright (c) ${docInfo.year} ${docInfo.company}
 */
@Data
@TableName("${table.name}")
@Schema(name = "${javaAttribute.model.name}",title = "${javaAttribute.model.name}",description = "${javaAttribute.description}")
public class ${javaAttribute.model.name} implements Serializable {

<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list columns as column>
    <#if column.tableColumn.comment!?length gt 0>
    /**
     * ${column.tableColumn.comment}
     */
    </#if>
    <#if column.tableColumn.comment!?length gt 0>
    @Schema(name = "${column.columnName}",title = "${column.tableColumn.name}",description = "${column.tableColumn.comment}")
    </#if>
    <#if column.tableColumn.keyFlag>
    <#-- 主键 -->
        <#if column.tableColumn.idType??>
            <#if column.tableColumn.idType == "NONE">
    @TableId("${column.tableColumn.name}")
            <#else>
    @TableId(value = "${column.tableColumn.name}", type = IdType.${column.tableColumn.idType})
            </#if>
        </#if>
    <#-- 普通字段 -->
    <#else>
    <#--<#if column.tableColumn.name != column.columnName>-->
    <#--@TableField("${column.tableColumn.name}")-->
    <#--</#if>-->
    @TableField("${column.tableColumn.name}")
    </#if>
    <#if localDateFormatEnabled ==true>
        <#if column.tableColumn.columnType.type == "LocalDateTime">
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        <#elseif column.tableColumn.columnType.type == "LocalDate">
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
        <#else>
    </#if>
    </#if>
    private ${column.tableColumn.columnType.type} ${column.columnName};

</#list>
<#-- ----------  END 字段循环遍历  ---------->

<#list table.columns as column>
    public static final String ${column.name?upper_case} = "${column.name}";
</#list>

}
